<template>
  <div class="header">
    <div class="logo">人人码软件开发公司</div>
    <div class="nav">
      <div v-for="item in navs" :key="item._id">
        <router-link :to="item.url" tag="span">{{ item.title }}</router-link>
      </div>
    </div>
  </div>
</template>

<script>
import { getNavs } from '@/network/api';

export default {
  name: 'Index',
  data() {
    return {
      navs: []
    };
  },
  created() {
    this.getNavsData();
  },
  methods: {
    getNavsData() {
      getNavs().then(res => {
        console.log(res.data);
        this.navs = res.data;
      });
    }
  }
};
</script>

<style scoped lang="less">
.header {
  display: flex;
  height: 75px;
  width: 100%;
  background: rgb(27, 27, 27);
  .logo {
    flex: 1;
    color: #fff;
    font-size: 25px;
    display: flex;
    align-items: center;
    padding-left: 100px;
  }
  .nav {
    flex: 1;
    display: flex;
    & > div {
      height: 100%;
      span {
        display: block;
        height: 100%;
        display: flex;
        align-items: center;
        font-size: 16px;
        color: #fff;
        padding: 0 35px;
        transition: all 0.1s;
        cursor: pointer;
        &:hover{
          font-size: 25px;
        }
      }
    }
  }
}
</style>
